package com.example.wm_mbp.config;

/**
 * Created with IntelliJ IDEA.
 * ClassName: BaseContext
 * Package: com.example.wm_mbp.config
 * Description:
 * User: fzykd
 *
 * @Author: LQH
 * Date: 2023-03-20
 * Time: 23:30
 */


/**
 * 基础ThreadLocal封装工具类,用户保存和获取当前登录用户的id
 */
public class BaseContext {
    //每一个线程单独保存自己的信息
    private static ThreadLocal<Long> threadLocal = new ThreadLocal<>();

    public static void setCurrentId(Long id){
        threadLocal.set(id);
    }


    public static Long getCurrentId(){
        return threadLocal.get();
    }

}
